package twitorg;

import java.io.IOException;
import java.net.URLEncoder;
import java.util.Map;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class SearchServlet extends HttpServlet
{
    public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException
    {
        Map<String, String> params = TwitorgServlet.getParams(req);
        if (params.containsKey("query"))
        {
            String query = params.get("query");
            query = URLEncoder.encode(query, "UTF-8");
            resp.sendRedirect("/data?" + TwitorgServlet.asParamString(params));
        }
    }
}
